import { useRouter } from 'vue-router'
import moment from 'moment'
//  自己封装公共函数

export const useCommon = () => {
    const router = useRouter();

    const gotoOnePage = (url: string) => {
        router.push(url)
    }

    const goback = () => {
        router.go(-1);       
    }

    const dateFormatInit = (date:any,type:string='YYYY-MM-DD HH:mm:ss')=>{
        return moment(date).format(type)
    }

    return {
        gotoOnePage,
        goback,
        dateFormatInit
    }
}